package com.fc.common.util;

import java.util.Random;

/**
 * @author 作者相关信息
 * @version 1.0 版本信息
 * @description 类的描述
 * @date 2022/02/27 15:12
 */
public class RandomUtil {
    public static void main(String[] args) {
        System.out.println(getCode());
    }
    public static String getCode() {
        Random r = new Random();
        String result = "";
        for (int i = 0; i < 4; i++) {
            int king = r.nextInt(3);
            int range = 0;
            int startCode = 0;
            switch (king) {
                case 0:
                    range = 26;
                    startCode = 97;
                    break;
                case 1:
                    range = 26;
                    startCode = 65;
                    break;
                case 2:
                    range = 10;
                    startCode = 48;
            }
            int num = r.nextInt(range);
            char c = (char) (startCode + num);
            result += c;
        }
        return result;
    }
}
